Add hostname to lockfile dependencies - #29
Conversation
Introduce lockfile schema v0.0.3 with a required canonical hostname on every dependency. Preserve hostnames from new lockfiles and default v0.0.1/v0.0.2 dotcom-only entries to github.com in memory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ensure equivalent pin casing cannot skip required action-field checks during scoped parsing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Null dependency values can bypass required hostname validation, including during scoped parsing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
go/pkg/lockfile/compat.go — A referenced dependency with a null YAML value bypasses all required-field validation: yaml.v3… |
What changed in this PR
Adds lockfile schema v0.0.3 with per-dependency hostnames while retaining compatibility with earlier schemas.
Changes:
- Adds and embeds the v0.0.3 schema.
- Preserves v0.0.3 hostnames and defaults legacy files to
github.com. - Updates scoped validation, tests, benchmarks, and documentation.
| File | Description |
|---|---|
schema/lockfile-v0.0.3.json |
Defines schema v0.0.3. |
README.md |
Documents hostname support. |
go/pkg/lockfile/schema.go |
Exposes the latest schema. |
go/pkg/lockfile/schema_test.go |
Tests schema and hostname validation. |
go/pkg/lockfile/schema_gen.go |
Embeds the generated schema. |
go/pkg/lockfile/lockfile.go |
Adds hostname metadata and validation. |
go/pkg/lockfile/internal/cmd/genschema/main.go |
Generates all schema constants. |
go/pkg/lockfile/compat.go |
Adds v0.0.3 and legacy migration support. |
go/pkg/lockfile/compat_test.go |
Tests compatibility behavior. |
go/pkg/lockfile/bench_test.go |
Updates benchmarks for v0.0.3. |
Files not reviewed (2)
- go/pkg/lockfile/internal/cmd/genschema/main.go: Generated file
- go/pkg/lockfile/schema_gen.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Traverse each selected workflow's reachable uses graph before applying schema-specific dependency validation. Reject malformed dependency bodies and non-string hostnames while preserving scoped fail-open behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow dotcom-only v0.0.3 lockfiles to omit hostname while retaining strict validation when the field is present. Preserve legacy normalization and scoped graph validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f6db8ef-20bf-421d-878b-6d044d3865ea
| import "testing" | ||
|
|
||
| var benchV002 = []byte(`version: v0.0.2 | ||
| var benchV003 = []byte(`version: v0.0.3 |
There was a problem hiding this comment.
Keep benchV002 and its benchmark as the compatibility baseline, then add benchV003 as a distinct entry. Replacing v0.0.2 drops coverage and prevents comparing parse cost across schema versions.
There was a problem hiding this comment.
Good point. I restored benchV002, BenchmarkParse_V002, and BenchmarkParseWithPolicy_V002, and kept the v0.0.3 cases separate. That preserves the compatibility baseline and lets us compare parse cost across versions.
| "properties": { | ||
| "hostname": { | ||
| "description": "The optional canonical hostname of the GitHub instance that owns and resolves this dependency (for example, github.com). Hostname-aware producers record the exact canonical hostname for every dependency; when present, consumers use it to select the matching resolver.", | ||
| "type": "string", |
There was a problem hiding this comment.
Can we constrain this to a canonical hostname, either github.com or a GHE tenant hostname such as octocorp.ghe.com? The value should be the bare hostname only, with no protocol, port, path, query string, fragment, or surrounding whitespace.
There was a problem hiding this comment.
Updated. When present, hostname now accepts only github.com or a lowercase <tenant>.ghe.com hostname. The schema and Go parser reject schemes, ports, paths, queries, fragments, surrounding whitespace, arbitrary domains, and invalid tenant labels. I also added focused coverage and a drift check so schema and parser enforcement stay aligned.
Accept only github.com or canonical GHE tenant hostnames when hostname is present. Restore the v0.0.2 benchmark baseline alongside v0.0.3 for compatibility comparisons. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f6db8ef-20bf-421d-878b-6d044d3865ea

Summary
hostnameon each dependencygithub.comor a lowercase<tenant>.ghe.comhostnamegithub.comin memory without changing either published schema or the source lockfileAction.UsesgraphThis is the first
actions-lockfilestep for github/actions-dispatch#1126. Hostname-aware Proxima producers will record the resolved hostname for every direct and transitive dependency. Reader support still needs to roll out beforegh-actions-lockstarts writing v0.0.3.Testing
go test ./... -count=1go vet ./...bash script/release_test